<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create New Task </title>
<script language="javascript" type="text/javascript"
	src="js/datepicker.js"></script>
<link rel="stylesheet" href="css/datepicker.css" />
<link rel="stylesheet" href="css/common.css" />
<script language="javascript" type="text/javascript" src="js/common.js"></script>
<script language="javascript" type="text/javascript"
	src="js/jquery-1.6.1.min.js"></script>

<script language="javascript" type="text/javascript">
	var requiredInputs = [['name','name_required'],['code','code_required'],['description','description_required'],['id_employee','id_employee_required'],['id_type','id_type_required'],['status','status_required'],['plan_start_time','plan_start_time_date_required', 'plan_start_time','plan_start_time_time_required'],['plan_end_time','plan_end_time_date_required', 'plan_end_time','plan_end_time_time_required'],['real_start_tate','real_start_tate_date_required', 'real_start_tate','real_start_tate_time_required'],['real_end_time','real_end_time_date_required', 'real_end_time','real_end_time_time_required'],['notification','notification_required'],['rate','rate_required']];
	var intInputs = [['id_employee','id_employee_invalid'],['id_type','id_type_invalid'],['id_phase','id_phase_invalid'],['status','status_invalid'],['notification','notification_invalid'],['rate','rate_invalid']];
	var doubleInputs = [];
	var dateInputs = [['plan_start_time','plan_start_time_date_invalid'],['plan_end_time','plan_end_time_date_invalid'],['real_start_tate','real_start_tate_date_invalid'],['real_end_time','real_end_time_date_invalid']];
	var timeInputs = [['plan_start_time','plan_start_time_time_invalid'],['plan_end_time','plan_end_time_time_invalid'],['real_start_tate','real_start_tate_time_invalid'],['real_end_time','real_end_time_time_invalid']];

	function checkInputs() {
		var valid = true;

		if (checkRequiredInputs(requiredInputs) == false) {
			valid = false;
		}
		if (checkIntInputs(intInputs) == false) {
			valid = false;
		}
		if (checkDoubleInputs(doubleInputs) == false) {
			valid = false;
		}
		if (checkDateInputs(dateInputs) == false) {
			valid = false;
		}
		if (checkTimeInputs(timeInputs) == false) {
			valid = false;
		}

		// SPECIFIC VALIDATE CODE HERE		

		return valid;
	}
</script>
</head>
<body>
	<form action="taskServlet?mode=insert" method="post"
        onSubmit="return checkInputs()"
        onreset="return confirm('Do you really want to reset the form?')">
		<table class="tblInput" border="1">
			<tr class="inputHeader">
				<td colspan="3" class="inputHeader">Create New Task </td>
			</tr>
			<tr class="trField">
				<td class="tdFieldName">Name </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="name" name="name" maxlength="255" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Name  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Name  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Code </td>			    <td class="tdFieldInput">
					<input class="inputText" type="text" id="code" name="code" maxlength="20" />
				</td>
				<td class="tdErrMsg">
					<span id="abb_name_required" class="errMsg" style="display: none;">Code  is required</span>
					<span id="abb_name_invalid" class="errMsg" style="display: none;">Code  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Description </td>				    <td class="tdFieldInput">
					<textarea id="description" name="description" rows="5" class="inputTextarea"></textarea>
				</td>
				<td class="tdErrMsg">
					<span id="description_required" class="errMsg" style="display: none;">Description  is required</span>
					<span id="description_invalid" class="errMsg" style="display: none;">Description  is invalid</span>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Id Employee </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="id_employee" name="id_employee" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="id_employee_required" class="errMsg" style="display: none;">Id Employee  is required</span> 
					<span id="id_employee_invalid" class="errMsg" style="display: none;">Id Employee  is invalid</span>
                </td></tr>
			<tr class="trField">
				<td class="tdFieldName">Id Type </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="id_type" name="id_type" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="id_type_required" class="errMsg" style="display: none;">Id Type  is required</span> 
					<span id="id_type_invalid" class="errMsg" style="display: none;">Id Type  is invalid</span>
                </td></tr>
			<tr class="trField">
				<td class="tdFieldName">Id Phase </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="id_phase" name="id_phase" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="id_phase_required" class="errMsg" style="display: none;">Id Phase  is required</span> 
					<span id="id_phase_invalid" class="errMsg" style="display: none;">Id Phase  is invalid</span>
                </td></tr>
			<tr class="trField">
				<td class="tdFieldName">Status </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="status" name="status" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="status_required" class="errMsg" style="display: none;">Status  is required</span> 
					<span id="status_invalid" class="errMsg" style="display: none;">Status  is invalid</span>
                </td></tr>
			<tr class="trField">
				<td class="tdFieldName">Plan Start Time </td>				<td class="tdFieldInput">
					<table class="tblDateTime">
						<tr class="trDateTime">
							<td class="tdDate">
								<input type="text" maxlength="10" class="inputDate" id="plan_start_time_date" name="plan_start_time_date" /> 
								<input type="button" class="btnCalendar" value="..."
									onclick="javascript:displayDatePicker('plan_start_time_date', this, dateFormat);" />
							</td>
							<td class="tdTime">
								<input type="text" maxlength="5" class="inputTime" id="plan_start_time_time" name="plan_start_time_time" />
							</td>
						</tr>
					</table></td>
				<td class="tdErrMsg">
					<div class="divErr">
						<span id="plan_start_time_date_required" class="errMsg"
							style="display: none;">Plan Start Time 's date is required</span>
					</div>
					<div class="divErr">
						<span id="plan_start_time_time_required" class="errMsg"
							style="display: none;">Plan Start Time 's time is required</span>
					</div>
					<div class="divErr">
						<span id="plan_start_time_date_invalid" class="errMsg"
							style="display: none;">Plan Start Time 's date is invalid</span>
					</div>
					<div class="divErr">
						<span id="plan_start_time_time_invalid" class="errMsg"
							style="display: none;">Plan Start Time 's time is invalid</span>
					</div>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Plan End Time </td>				<td class="tdFieldInput">
					<table class="tblDateTime">
						<tr class="trDateTime">
							<td class="tdDate">
								<input type="text" maxlength="10" class="inputDate" id="plan_end_time_date" name="plan_end_time_date" /> 
								<input type="button" class="btnCalendar" value="..."
									onclick="javascript:displayDatePicker('plan_end_time_date', this, dateFormat);" />
							</td>
							<td class="tdTime">
								<input type="text" maxlength="5" class="inputTime" id="plan_end_time_time" name="plan_end_time_time" />
							</td>
						</tr>
					</table></td>
				<td class="tdErrMsg">
					<div class="divErr">
						<span id="plan_end_time_date_required" class="errMsg"
							style="display: none;">Plan End Time 's date is required</span>
					</div>
					<div class="divErr">
						<span id="plan_end_time_time_required" class="errMsg"
							style="display: none;">Plan End Time 's time is required</span>
					</div>
					<div class="divErr">
						<span id="plan_end_time_date_invalid" class="errMsg"
							style="display: none;">Plan End Time 's date is invalid</span>
					</div>
					<div class="divErr">
						<span id="plan_end_time_time_invalid" class="errMsg"
							style="display: none;">Plan End Time 's time is invalid</span>
					</div>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Real Start Tate </td>				<td class="tdFieldInput">
					<table class="tblDateTime">
						<tr class="trDateTime">
							<td class="tdDate">
								<input type="text" maxlength="10" class="inputDate" id="real_start_tate_date" name="real_start_tate_date" /> 
								<input type="button" class="btnCalendar" value="..."
									onclick="javascript:displayDatePicker('real_start_tate_date', this, dateFormat);" />
							</td>
							<td class="tdTime">
								<input type="text" maxlength="5" class="inputTime" id="real_start_tate_time" name="real_start_tate_time" />
							</td>
						</tr>
					</table></td>
				<td class="tdErrMsg">
					<div class="divErr">
						<span id="real_start_tate_date_required" class="errMsg"
							style="display: none;">Real Start Tate 's date is required</span>
					</div>
					<div class="divErr">
						<span id="real_start_tate_time_required" class="errMsg"
							style="display: none;">Real Start Tate 's time is required</span>
					</div>
					<div class="divErr">
						<span id="real_start_tate_date_invalid" class="errMsg"
							style="display: none;">Real Start Tate 's date is invalid</span>
					</div>
					<div class="divErr">
						<span id="real_start_tate_time_invalid" class="errMsg"
							style="display: none;">Real Start Tate 's time is invalid</span>
					</div>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Real End Time </td>				<td class="tdFieldInput">
					<table class="tblDateTime">
						<tr class="trDateTime">
							<td class="tdDate">
								<input type="text" maxlength="10" class="inputDate" id="real_end_time_date" name="real_end_time_date" /> 
								<input type="button" class="btnCalendar" value="..."
									onclick="javascript:displayDatePicker('real_end_time_date', this, dateFormat);" />
							</td>
							<td class="tdTime">
								<input type="text" maxlength="5" class="inputTime" id="real_end_time_time" name="real_end_time_time" />
							</td>
						</tr>
					</table></td>
				<td class="tdErrMsg">
					<div class="divErr">
						<span id="real_end_time_date_required" class="errMsg"
							style="display: none;">Real End Time 's date is required</span>
					</div>
					<div class="divErr">
						<span id="real_end_time_time_required" class="errMsg"
							style="display: none;">Real End Time 's time is required</span>
					</div>
					<div class="divErr">
						<span id="real_end_time_date_invalid" class="errMsg"
							style="display: none;">Real End Time 's date is invalid</span>
					</div>
					<div class="divErr">
						<span id="real_end_time_time_invalid" class="errMsg"
							style="display: none;">Real End Time 's time is invalid</span>
					</div>
				</td></tr>
			<tr class="trField">
				<td class="tdFieldName">Need Approval </td><td class="tdFieldInput">
					<table class="tblBool">
						<tr class="trBoolSet">
							<td colspan="2" class="tdBoolSet"><input type="checkbox"
								id="ckb_need_approval" name="ckb_need_approval"
								onchange="toggleControls(['need_approval_true', 'need_approval_false'])" />Not
								set</td>
						</tr>
						<tr class="trBool">
							<td class="tdBool"><input type="radio"
								id="need_approval_true" name="need_approval" value="1"
								checked="checked" />Yes</td>
							<td class="tdBool"><input type="radio"
								id="need_approval_false" name="need_approval" value="0" />No</td>
						</tr>
					</table></td>
				<td class="tdErrMsg"></td></tr>
			<tr class="trField">
				<td class="tdFieldName">Is Event </td><td class="tdFieldInput">
					<table class="tblBool">
						<tr class="trBoolSet">
							<td colspan="2" class="tdBoolSet"><input type="checkbox"
								id="ckb_is_event" name="ckb_is_event"
								onchange="toggleControls(['is_event_true', 'is_event_false'])" />Not
								set</td>
						</tr>
						<tr class="trBool">
							<td class="tdBool"><input type="radio"
								id="is_event_true" name="is_event" value="1"
								checked="checked" />Yes</td>
							<td class="tdBool"><input type="radio"
								id="is_event_false" name="is_event" value="0" />No</td>
						</tr>
					</table></td>
				<td class="tdErrMsg"></td></tr>
			<tr class="trField">
				<td class="tdFieldName">Is Draft </td><td class="tdFieldInput">
					<table class="tblBool">
						<tr class="trBoolSet">
							<td colspan="2" class="tdBoolSet"><input type="checkbox"
								id="ckb_is_draft" name="ckb_is_draft"
								onchange="toggleControls(['is_draft_true', 'is_draft_false'])" />Not
								set</td>
						</tr>
						<tr class="trBool">
							<td class="tdBool"><input type="radio"
								id="is_draft_true" name="is_draft" value="1"
								checked="checked" />Yes</td>
							<td class="tdBool"><input type="radio"
								id="is_draft_false" name="is_draft" value="0" />No</td>
						</tr>
					</table></td>
				<td class="tdErrMsg"></td></tr>
			<tr class="trField">
				<td class="tdFieldName">Notification </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="notification" name="notification" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="notification_required" class="errMsg" style="display: none;">Notification  is required</span> 
					<span id="notification_invalid" class="errMsg" style="display: none;">Notification  is invalid</span>
                </td></tr>
			<tr class="trField">
				<td class="tdFieldName">Rate </td>				<td class="tdFieldInput">
					<input class="inputInt" type="text" id="rate" name="rate" maxlength="10" />
				</td>
				<td class="tdErrMsg">
					<span id="rate_required" class="errMsg" style="display: none;">Rate  is required</span> 
					<span id="rate_invalid" class="errMsg" style="display: none;">Rate  is invalid</span>
                </td></tr>
			
			<tr class="trInputBottom">
				<td class="trInputBottom" colspan="3">
					<table class="tblSubmit" align="center">
						<tr class="trSubmit">
							<td class="tdSubmit"><input type="submit" value="Submit" />
							</td>
							<td class="tdReset"><input type="reset" value="Reset" /></td>
						</tr>
					</table></td>
			</tr>
		</table>
	</form>
</body>
</html>